package com.moxi.dao;

import com.moxi.model.News;
import com.moxi.model.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * Created by zpq on 18/8/24.
 */
@Mapper
public interface UserDao {
    @Insert("INSERT INTO `moxi`.`t_user` (`id`, `userName`, `wxLoginName`, `mobile`, `limitCnt`, `type`, `token`) " +
            "VALUES (null, #{userName}, #{wxLoginName}, #{mobile}, #{limitCnt}, #{type}, #{token}")
    int insert(User admin);

    @Select("SELECT * FROM `video_watermark`.`t_user` where token = #{token};")
    public User queryByToken(User user);

    @Update("UPDATE `video_watermark`.`t_user` SET `userName` = #{userName}, `wxLoginName` = #{wxLoginName}, `mobile` = #{mobile}, `limitCnt` = #{limitCnt}, `type` = #{type}, `token` = #{token} WHERE `id` = #{id};")
    int updateState(News news);
}
